package controller;

import java.io.IOException;
import javax.servlet.http.*;

public class Logout extends HttpServlet
{
	public void doGet(HttpServletRequest request, HttpServletResponse response)
	{
		HttpSession session = request.getSession(true);
		
		if(session.getAttribute("customer") !=null) {session.removeAttribute("customer");}
		if(session.getAttribute("invalidUser") !=null) {session.removeAttribute("invalidUser");}
		if(session.getAttribute("bookList") !=null) {session.removeAttribute("bookList");}
		if(session.getAttribute("cart") != null){session.removeAttribute("cart");};
		if(session.getAttribute("cartItemCount") != null){session.removeAttribute("cartItemCount");};
		if(session.getAttribute("financeAccount") != null){session.removeAttribute("financeAccount");};
		if(session.getAttribute("transactionNumber") != null){session.removeAttribute("transactionNumber");};		
		
		try 
		{
			response.sendRedirect("../index.jsp");
		} catch (IOException e) { e.printStackTrace();
		}	
	
	}
}
